<template>
    <div class="app-container">
        <el-form :model="usePersonFormData" ref="usePersonFormData"  label-width="120px">
            <el-row>
                  <el-col :span="12">
                      <el-form-item label="申请人">
                          {{usePersonFormData.applyUser}}
                      </el-form-item>
                  </el-col>
                  <el-col :span="12">
                      <el-form-item label="申请部门" >
                        {{usePersonFormData.applyUserDeptName}}
                      </el-form-item>
                  </el-col>
              </el-row>
              <el-row>
                  <el-col :span="12">
                      <el-form-item label="到岗日期" prop="workDate">
                          <el-date-picker
                              :disabled="true"
                              style="width:100%"
                              v-model="usePersonFormData.workDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="选择开始日期">
                          </el-date-picker>
                      </el-form-item>
                  </el-col>
                  <el-col :span="12">
                      <el-form-item label="用人类型" prop="usePersonType">
                        <el-select v-model="usePersonFormData.usePersonType" style="width:100%" :disabled="true" clearable>
                            <el-option v-for="item in usePersonTypeOptions" :key="item.id" 
                                :value="item.dictValue" :label="item.dictLabel"></el-option>
                        </el-select>
                      </el-form-item>
                  </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                      <el-form-item label="岗位要求" prop="isReturnEquipment">
                          <el-input v-model="usePersonFormData.workRequire" :disabled="true" clearable style="width:100%"></el-input>
                      </el-form-item>
                </el-col>
                <el-col :span="12">
                      <el-form-item label="岗位职责" prop="approvedDept">
                        <el-input v-model="usePersonFormData.workDuty" :disabled="true" clearable style="width:100%"></el-input>
                      </el-form-item>
                </el-col>
              </el-row>
              <el-form-item label="用人原因" prop="usePersonReason">
                  <el-input v-model="usePersonFormData.usePersonReason" :disabled="true" clearable type="textarea" ></el-input>
              </el-form-item>

              <el-form-item label="抄送人" prop="ccUsers">
                <el-tag v-for="item in usePersonFormData.ccUserList" :key="item" style="margin-left: 3px;">{{item}}</el-tag>
              </el-form-item>
              <el-form-item label="上传附件" >
                <el-upload :disabled="true"
                    :action="upload.url"
                    class="upload-demo"
                    :on-preview="handlePreview"
                    :file-list="usePersonFormData.files">
                </el-upload>
              </el-form-item>
              <el-row>
                <el-col :span="12">
                    <el-form-item label="提交人" prop="goodsName">
                        {{usePersonFormData.createBy}}
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="提交时间" prop="buyCount">
                        {{parseTime(usePersonFormData.createTime)}}
                    </el-form-item>
                </el-col>
              </el-row>
          </el-form>
    </div>
  </template>
  
  <script>
  
  export default {
    name: "usePersonDetail",
    props:{
        usePersonFormData: Object,
        isShowQuit: Boolean,
    },
    data() {
      return {
          fileList:[],
          upload:{
              url: process.env.VUE_APP_BASE_API + "/test/uploadImage",
          },
          props:{multiple: true},
          usePersonTypeOptions:[]
      };
    },
  
    created() {
      
        this.getDicts("use_person_type").then(response => {
            this.usePersonTypeOptions = response.data;
        });
    },
    methods: {
      handlePreview(file){
          this.preFile(file.url)
      },
      preFile(fileName){
        window.open(process.env.VUE_APP_BASE_API + "/school/file/" +fileName)
      },
    }
  };
  </script>
  
<style>
.el-upload{
    display: flex;
}
</style>